package com.heima.model.behavior.pojos;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.heima.model.annotation.IdEncrypt;
import lombok.Builder;
import lombok.Data;
import org.apache.ibatis.type.Alias;

/**
 * APP点赞行为表
 */
@Data
@TableName(value = "ap_likes_behavior")
public class ApLikesBehavior {
    @TableId(value = "id", type = IdType.INPUT)
    private Long id;

    /**
     * 实体ID
     */
    @IdEncrypt
    @TableField(value = "behavior_entry_id")
    private Integer behaviorEntryId;

    /**
     * 文章ID
     */
    @IdEncrypt
    @TableField(value = "entry_id")
    private Integer entryId;

    /**
     * 点赞内容类型
     * 0文章
     * 1动态
     */
    @TableField(value = "type")
    private Short type;

    /**
     * 0 点赞
     * 1 取消点赞
     */
    @TableField(value = "operation")
    private Short operation;

    /**
     * 登录时间
     */
    @TableField(value = "created_time")
    private Date createdTime;

    @JsonIgnore
    @TableField(value = "burst")
    private String burst;

    // 定义点赞内容的类型
    @Alias("ApLikesBehaviorEnumType")
    public enum Type{
        ARTICLE((short)0),DYNAMIC((short)1),COMMENT((short)2);
        short code;
        Type(short code){
            this.code = code;
        }
        public short getCode(){
            return this.code;
        }
    }
    //定义点赞操作的方式，点赞还是取消点赞
    @Alias("ApLikesBehaviorEnumOperation")
    public enum Operation{
        LIKE((short)0),CANCEL((short)1);
        short code;
        Operation(short code){
            this.code = code;
        }
        public short getCode(){
            return this.code;
        }
    }
}
